<template>
<t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
      </t-image-viewer>
      <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
      </van-image-preview> 
  <div class="outline-parent jy-style-height">
    <div class="flex-box border-hover-style">
      
      <t-popup 
        class="placement bottom center"
        attach="#attach"
        content="查看本单元全景展厅"
        placement="bottom" 
        showArrow
        destroyOnClose
      >
        <img
          v-if="props.info.digitalShowroom" 
          class="icon-3d blinking-animation-style"
          id="outlineIcon"
          @click="open(props.info.digitalShowroom)"
          :src="publicUrls + 'free/style2/3dIcon.webp'"
        />
      </t-popup>
      <img class="outline-parent-bg" :src="publicUrls + 'free/style2/Level2outlineStyle2Bg.webp'" alt="" />
      <div class="outline">
        <div
          class="outline-content"
          :style="(!props.info.value || (!props.info.subTitle && !props.info.remarks)) && { paddingTop: '0px' }"
          :class="(props.info.subTitle || props.info.remarks) && 'content-line'"
        >
          <div
            class="content-box-right"
            v-html="textType(props.info.text, 4)"
            :style="(!props.info.value || (!props.info.subTitle && !props.info.remarks)) && { position: 'relative' }"
          ></div>
          <p
            class="outline-subTitle"
            :class="props.info.text?.length > 8 && 'outline-margin'"
            v-if="props.info.subTitle"
          >
            {{ props.info.subTitle }}
          </p>
          <div class="cover" v-if="props.info.value" :class="!props.info.subTitle && !props.info.remarks && 'coverImg'">
            <img
              :class="props.info.text?.length > 8 && (props.info.subTitle || props.info.remarks) && 'outline-margin'"
              class="outline-cover"
              @click="ImgVisible = true"
              :src="urls + props.info.value + '?imageView2/3/format/webp'"
              alt=""
            />
          </div>
          <TextMax
            v-if="props.domShow"
            :data="props.info.remarks"
            :title="props.info.text"
            :infoData="props.info"
            :row="
              props.info.subTitle && props.info.value && props.info.text?.length <= 4
                ? 6
                : !props.info.subTitle && props.info.value && props.info.text?.length <= 4
                ? 7
                : !props.info.subTitle && !props.info.value && props.info.text?.length <= 4
                ? 14
                : props.info.subTitle && props.info.value && props.info.text?.length > 4
                ? 6
                : !props.info.subTitle && !props.info.value && props.info.text?.length <= 10
                ? 14
                : 8
            "
          ></TextMax>
        </div>
      </div>
    </div>
    <img class="shadow" :src="publicUrls + 'free/style2/firstLevelOutline1Shadow.webp'" alt="" />
  </div>
</template> 

<script lang="ts">
export default defineComponent({
  name: 'free2Style1',
});
</script>

<script setup lang="ts">
import { publicUrls, textType } from '@/utils/minxin';
import textMode from '../../../textMode/textMode.vue';
import { urls } from '@/utils/request/upload';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { defineComponent, ref } from 'vue';
import { useProjectStore } from '@/store';
const store = useProjectStore();

const ImgVisible = ref(false);

const props = defineProps({
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style scoped lang="less">
.outline-parent {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  margin-left: 80px;
  margin-right: 90px;
}
.shadow {
  width: 660px;
  height: 200px;
  position: absolute;
  bottom: 0;
  left: 0;
}
.icon-3d {
  width: 48px;
  height: 58px;
  object-fit: contain;
  position: absolute;
  top: -4px;
  right: 60px;
  z-index: 21;
}
.flex-box {
  width: 470px;
  height: 774px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.outline-parent-bg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
}
.outline {
  z-index: 20;
  width: 100%;
  height: 100%;
  padding: 60px 60px 80px 50px;
}
.outline-content {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
  padding-top: 124px;
}
.content-line {
  &::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    opacity: 0.6;
    background: #212326;
  }
}
.content-box-right {
  // width: 34px;
  width: auto;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  ::v-deep p {
    border-left: 1px solid #212326;
    border-right: 1px solid #212326;
    background: #ffdc76;
    font-family: ZKTSHIKTS--GB1, ZKTSHIKTS--GB1;
    font-weight: normal;
    font-size: 32px;
    color: #212326;
    line-height: 32px;
    text-align: left;
    writing-mode: vertical-rl; /* 从右到左的竖向排列 */
    &:nth-child(2) {
      position: absolute;
      // position: sticky;
      margin-left: 34px;
      border-left: none;
    }
  }
}
.outline-margin {
  padding-left: 90px;
}
.outline-subTitle {
  width: 100%;
  font-family: SourceHanSerifCN;
  font-size: 18px;
  color: #212326;
  line-height: 28px;
  text-align: justify;
  opacity: 0.8;
  margin-top: 24px;
}
.coverImg {
  // max-height: 100%;
  // min-height: 100%;
  max-height: 100% !important;
  flex: 1;
  border-top: 1px solid rgba(33, 35, 38, 0.6);
  padding-top: 24px;
}
.cover {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-height: 224px;
  margin-top: 16px;
  overflow: hidden;
  .outline-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

::v-deep .textMore-box {
  margin: 16px 0;
}
::v-deep .van-text-ellipsis {
  font-family: SourceHanSerifCN-Medium !important;
  font-size: 18px !important;
  color: rgba(33, 35, 38, 0.6) !important;
  line-height: 32px !important;
}
::v-deep .van-text-ellipsis__action::before {
  color: #ffdc76 !important;
  font-weight: 400 !important;
  text-decoration-line: underline;
}
::v-deep .t-popup__content {
  background: #5b8c87;
  box-shadow: none;
  padding: 4px 10px;
  // font-size: 14px !important;
  line-height: 22px;
  color: #fff;
  box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.1), 0px 8px 10px 1px rgba(0, 0, 0, 0.06),
    0px 3px 14px 2px rgba(0, 0, 0, 0.05);
}
::v-deep .t-popup__arrow::before {
  background: #5b8c87;
  border: none;
  box-shadow: none !important;
}
</style>